package karileet.meeting.profile.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.view.Menu;
import karileet.meeting.profile.R;

/**
 * Abstract class for wrapping simple list fragments
 * Created by markus on 1.11.14.
 */
public abstract class AbstractActivity extends FragmentActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        String parentList = "main_list";
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_list);
        ListFragment mainList = getFragment();

        if (savedInstanceState != null) {
            getSupportFragmentManager().findFragmentByTag(parentList);
        } else {
            getSupportFragmentManager().beginTransaction()
                    .add(android.R.id.content, mainList, parentList).commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        // getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    public abstract ListFragment getFragment();

}
